package com.sitech.portal.bigScreen.dao.ibatis;

import com.sitech.ibnms.core.BaseIbnmsDao;
import com.sitech.ibnms.core.IPage;
import com.sitech.ibnms.core.PageForm;
import com.sitech.portal.bigScreen.dao.ScreenLogicalDao;
import com.sitech.portal.bigScreen.dao.ScreenLogicalDao;
import com.sitech.portal.bigScreen.domain.ScreenLogicalPanel;
import com.sitech.portal.bigScreen.domain.TbScreenLogical;
import com.sitech.portal.bigScreen.form.ScreenLogicalPanelForm;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2015/4/22.
 */
public class ScreenLogicalDaoImpl extends BaseIbnmsDao implements ScreenLogicalDao {
    @Override
    public void addScreenLogical(TbScreenLogical tbScreenLogical) {
        super.insert("addScreenLogical",tbScreenLogical);
    }

    @Override
    public IPage queryScreenLogicalByFilter(TbScreenLogical tbScreenLogical,String physicalScreenId,PageForm pageForm) {
        Map<String,Object> param=new HashMap<String, Object>();
        param.put("LOGICAL_SCREEN_NAME",tbScreenLogical.getLOGICAL_SCREEN_NAME());
        param.put("physicalScreenId",physicalScreenId);
        return super.findPage("queryLogicalScreenByFilter",param,pageForm);
    }

    @Override
    public void deleteScreenLogicalById(String id) {
        super.delete("deleteScreenLogicalById",id);
    }

    @Override
    public void updateScreenLogical(TbScreenLogical tbScreenLogical) {
        super.update("updateScreenLogical",tbScreenLogical);
    }

    @Override
    public IPage queryScreenLogicalByPhysicalScreen(String physicalScreenId,PageForm pageForm) {
        return super.findPage("queryLogicalScreenByPhysicalId",physicalScreenId,pageForm);
    }

    @Override
    public TbScreenLogical queryLogicalScreenById(String id) {
        return (TbScreenLogical)super.querySingle("queryLogicalScreenById",id);
    }

    @Override
    public void relatedPanelToScreen(ScreenLogicalPanel screenLogicalPanel) {
        super.insert("relatedPanelToScreen",screenLogicalPanel);
    }

    @Override
    public void unrelatedPanelToScreen(String logicalScreenId) {
        super.delete("unrelatedPanelToScreen",logicalScreenId);
    }

    @Override
    public List<ScreenLogicalPanelForm> queryScreenLogicalPanelByScreenId(String screenId) {
        return query("queryScreenLogicalPanelByScreenId",screenId);
    }

    @Override
    public boolean ifNameExist(TbScreenLogical tbScreenLogical) {
        return (Integer)super.querySingle("selectScreenLogicalCountByNameAndId",tbScreenLogical)>0?true:false;
    }

    @Override
    public List<TbScreenLogical> queryByPhysicalScreenId(String physicalScreenId) {
        return query("queryLogicalScreenByPhysicalId",physicalScreenId);
    }

    @Override
    public List<String> queryPhysicalScreenByLogicalScreenId(String logicalScreenId) {
        return query("queryPhysicalScreenByLogicalScreenId",logicalScreenId);
    }
}
